package com.csun.cmny.provider.model.enums.follow;

import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-02-18 09:40
 * @Description: the enum follow bpressure status enum.
 */
public enum FollowBpressureStatusEnum {

    /**
     * 低血压
     */
    BPRESSURE_LOW("低血压", "随身携带糖果,避免过度劳累,建议就医诊断", 0, 60, 0, 90),

    /**
     * 血压正常
     */
    BPRESSURE_NORMAL("血压正常", "适量运动,营养均衡,继续保持", 60, 90, 90, 140),

    /**
     * 高血压
     */
    BPRESSURE_HIGH("高血压", "低盐低脂肪饮食，避免情绪激动，建议就医诊断", 90, 300, 140, 300),

    /**
     * 脉压差大
     */
    BPRESSURE_DIFF("脉压差大", "建议就医诊断", 0, 60, 140, 300),

    /**
     * 脉压差大
     */
    BPRESSURE_DIFF_MORE("脉压差大", "建议就医诊断", 90, 300, 90, 140),;

    /**
     * 状态
     */
    String status;

    /**
     * 建议
     */
    String suggest;

    /**
     * 舒张压 - 底
     */
    Integer dbpLow;

    /**
     * 舒张压 - 高
     */
    Integer dbpHigh;

    /**
     * 收缩压 - 底
     */
    Integer sbpLow;

    /**
     * 收缩压 - 高
     */
    Integer sbpHigh;

    FollowBpressureStatusEnum(String status, String suggest, Integer dbpLow, Integer dbpHigh,
                              Integer sbpLow, Integer sbpHigh) {
        this.status = status;
        this.suggest = suggest;
        this.dbpLow = dbpLow;
        this.dbpHigh = dbpHigh;
        this.sbpLow = sbpLow;
        this.sbpHigh = sbpHigh;
    }

    /**
     * Gets status.
     *
     * @return  the status
     */
    public String getStatus() {
        return status;
    }

    /**
     * Gets suggest.
     *
     * @return  the suggest
     */
    public String getSuggest() {
        return suggest;
    }

    /**
     * 获取状态
     */
    public static String getStatus(Integer sbp, Integer dbp) {

        for (FollowBpressureStatusEnum ele : FollowBpressureStatusEnum.values()) {
            if (sbp.compareTo(ele.sbpLow) >=0 && sbp.compareTo(ele.sbpHigh) < 0
                    && dbp.compareTo(ele.dbpLow) >= 0 && dbp.compareTo(ele.dbpHigh) <0) {
                return ele.getStatus();
            }
        }
        return null;
    }

    /**
     * 获取建议
     */
    public static String getSuggest(Integer sbp, Integer dbp) {

        for (FollowBpressureStatusEnum ele : FollowBpressureStatusEnum.values()) {
            if (sbp.compareTo(ele.sbpLow) >=0 && sbp.compareTo(ele.sbpHigh) < 0
                    && dbp.compareTo(ele.dbpLow) >= 0 && dbp.compareTo(ele.dbpHigh) <0) {
                return ele.getSuggest();
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<FollowBoxygenStatusEnum> getList() {
        return Arrays.asList(FollowBoxygenStatusEnum.values());
    }

}
